/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package banco_imobiliario.view;

import banco_imobiliario.control.ControladorInterface;
import banco_imobiliario.model.Jogador;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.media.CannotRealizeException;
import javax.media.Manager;
import javax.media.NoPlayerException;
import javax.media.Player;

/**
 *
 * @author Andre
 */
public class Carregando extends javax.swing.JFrame {

    /**
     * Creates new form Carregando
     */
    ControladorInterface controlInterface = ControladorInterface.getInstancia();
    HashMap<Integer, Jogador> listaJogadores;
    public Carregando() {
        
        initComponents();
        BufferedImage image=null;
        File imageFile=new File(".\\src\\banco_imobiliario\\imagens\\icone.png");
        try {
            image=ImageIO.read(imageFile);
            
        } catch (IOException ex) {
        }
        
        this.setIconImage(image);

        this.listaJogadores = listaJogadores;
        Thread thread = new Carregando.ThreadBasica1(); 
        thread.start();
        
    }

    class ThreadBasica1 extends Thread {
        // Este método(run()) é chamado quando a thread é iniciada
        
        public void run() {
            
            try {
                sleep(3000);
            } catch (InterruptedException ex) {
                Logger.getLogger(Carregando.class.getName()).log(Level.SEVERE, null, ex);
            }
            
            dispose();
            
            controlInterface.iniciarTabuleiro();
        }
    }
    
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel2 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Carregando");
        setResizable(false);

        jLabel2.setIcon(new javax.swing.ImageIcon("C:\\Users\\Andre\\Desktop\\carregando~2.gif")); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jLabel2)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 450, Short.MAX_VALUE)
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-726)/2, (screenSize.height-478)/2, 726, 478);
    }// </editor-fold>//GEN-END:initComponents

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
      
       
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel2;
    // End of variables declaration//GEN-END:variables
}
